package chaos.infinity.mixin.SetFlammable;

import chaos.infinity.TheInfinityBlocks;
import net.minecraft.block.AbstractFireBlock;
import net.minecraft.block.Blocks;
import net.minecraft.block.FireBlock;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;

@Mixin(FireBlock.class)
public abstract class Flammable_Mixin extends AbstractFireBlock {
    public Flammable_Mixin(Settings settings, float damage) {
        super(settings, damage);
    }

    @Inject(method = "registerDefaultFlammables", at = @At("TAIL"), locals = LocalCapture.CAPTURE_FAILHARD)
    private static void registerDefaultFlammables(CallbackInfo ci) {
        FireBlock fireBlock = (FireBlock) Blocks.FIRE;
        // 设置自定义方块的可燃性
        fireBlock.registerFlammableBlock(TheInfinityBlocks.GUNPOWDER_WIRE, 500, Integer.MAX_VALUE);
        // 前面是燃烧几率，是指火势燃烧到周围的几率
        // 后面是蔓延几率，是指火势蔓延到周围的几率
        // 修改原版方块的可燃性
    }
}
